﻿<%@ WebHandler Language="C#" Class="Color_Del" %>

using System;
using System.Web;
using Newtonsoft.Json;
public class Color_Del :  IHttpHandler, System.Web.SessionState.IReadOnlySessionState 
{ 
    public void ProcessRequest (HttpContext context) {
        OTS.Common.PageSuccess page = new OTS.Common.PageSuccess();
        if (!OTS.BaseLogin.validataModule(context, (int)OTS.enumSysRight.ColorManager))
        {
            page.success = false;
            page.msg = "非法操作！";

        }
        else
        {
            OTS.BLL.ColorBLL bll = new OTS.BLL.ColorBLL();
            string _id = context.Request["colId"];
            bool bRet = false;
            if (null != _id && !"".Equals(_id) && OTS.Common.Help.IsNumber(_id))
            {

                if (bll.Delete(int.Parse(_id)))
                {
                    bRet = true;
                }
            }
            if (bRet)
            {
                page.success = true;
                page.msg = "删除成功！";
            }
            else
            {
                page.success = false;
                page.msg = "参数有误！";

            }

        }
        context.Response.ContentType = "application/x-json";
        context.Response.Charset = "utf-8";
        context.Response.Write(JavaScriptConvert.SerializeObject(page));
    }
 
    public bool IsReusable {
        get {
            return false;
        }
    }

}